package d3s.net.interpolate
{
	import org.papervision3d.core.Number3D;
	
	/**
	 * @author Philippe Ajoux (philippe.ajoux@gmail.com)
	 * @version 05.01.07
	 */
	public class LinearTween extends Tween
	{
		public function LinearTween(object:*)
		{
			super(object);
		}
		
		public override function update(delta:uint):void
		{
			var p0:Number3D, p1:Number3D;
			
			if (points == null || index + 1 >= points.length)
				return;
				
			p0 = points[index];
			p1 = points[index + 1];
			
			object.x = p0.x + interp * (p1.x - p0.x);
			object.y = p0.y + interp * (p1.y - p0.y);
			object.z = p0.z + interp * (p1.z - p0.z);
			
			super.update(delta);
		}
	}
}